import cv2
from ultralytics import YOLO
model = YOLO("yolo11n-pose.pt")
nosex=0
nosey=0
def findObjects(img, objectCascade, scaleF=1.1, minN=4):
    imgObjects = img.copy()
    objects = ()
    results = model.predict(imgObjects , device=0, classes=[0] )  # results list
    print(results)
    for result in results:
        boxes = result.boxes
        keypoint = result.keypoints

        for point in range(len(keypoint)):
            nose = keypoint.xy[point][0]
            global nosex, nosey
            nosex, nosey = map(int, nose)

        for i in range(len(boxes)):
            x, y, w, h = map(int, boxes.xywh[i].tolist())
            x = x - w // 2
            y = y - h // 2
            person_coordinates = (x + w // 2, y + h // 2)
            print(x, y, w, h)
            objects.append([x, y, w, h])
            cv2.rectangle(imgObjects, (x, y), (x + w, y + h), (0, 255, 0), 2)
    return imgObjects, objects